<template>
  <div style="wight=100%">
    <el-select v-model="selected" placeholder="请选择" size="mini" @change="handleValueChange">
      <el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id"></el-option>
    </el-select>
  </div>
</template>

<script>
import { attributeCategory } from "@/api/product";
export default {
      name: "tabTategory",
  props: {
    value: null
  },
  watch: {
    value: {
      handler(newValue, oldValue) {
        this.selected = newValue;
      },
      immediate: true
    }
  },
  created() {
    this.getAttributeCategory();
  },
  data() {
    return {
      options: [],
      selected: ""
    };
  },
  methods: {
    getAttributeCategory() {
      attributeCategory().then(response => {
        this.options = response.data;
      });
    },
    handleValueChange() {
      this.$emit("change",this.selected)
    }
  }
};
</script>